﻿using System;
using System.Windows;
using System.Windows.Data;
using System.Globalization;

namespace Omnia.Converters
{
    public class NumberGreaterThanToVisibilityConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            if (value == null||string.IsNullOrWhiteSpace(value.ToString()))
            {
                return Visibility.Collapsed;
            }
            bool visible = double.Parse(value.ToString()) > double.Parse(parameter.ToString());
            return visible ? Visibility.Visible : Visibility.Collapsed;
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            return false;
        }
    }
}
